\doxysection{message\+\_\+buffer.\+h}
\hypertarget{message__buffer_8h_source}{}\label{message__buffer_8h_source}\index{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/Middlewares/Third\_Party/FreeRTOS/Source/include/message\_buffer.h@{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/Middlewares/Third\_Party/FreeRTOS/Source/include/message\_buffer.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*}}
\DoxyCodeLine{00002\ \textcolor{comment}{\ *\ FreeRTOS\ Kernel\ V10.3.1}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ Copyright\ (C)\ 2020\ Amazon.com,\ Inc.\ or\ its\ affiliates.\ \ All\ Rights\ Reserved.}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ Permission\ is\ hereby\ granted,\ free\ of\ charge,\ to\ any\ person\ obtaining\ a\ copy\ of}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ this\ software\ and\ associated\ documentation\ files\ (the\ "{}Software"{}),\ to\ deal\ in}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ the\ Software\ without\ restriction,\ including\ without\ limitation\ the\ rights\ to}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ use,\ copy,\ modify,\ merge,\ publish,\ distribute,\ sublicense,\ and/or\ sell\ copies\ of}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ the\ Software,\ and\ to\ permit\ persons\ to\ whom\ the\ Software\ is\ furnished\ to\ do\ so,}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ subject\ to\ the\ following\ conditions:}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *\ The\ above\ copyright\ notice\ and\ this\ permission\ notice\ shall\ be\ included\ in\ all}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ copies\ or\ substantial\ portions\ of\ the\ Software.}}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ THE\ SOFTWARE\ IS\ PROVIDED\ "{}AS\ IS"{},\ WITHOUT\ WARRANTY\ OF\ ANY\ KIND,\ EXPRESS\ OR}}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ IMPLIED,\ INCLUDING\ BUT\ NOT\ LIMITED\ TO\ THE\ WARRANTIES\ OF\ MERCHANTABILITY,\ FITNESS}}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *\ FOR\ A\ PARTICULAR\ PURPOSE\ AND\ NONINFRINGEMENT.\ IN\ NO\ EVENT\ SHALL\ THE\ AUTHORS\ OR}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ COPYRIGHT\ HOLDERS\ BE\ LIABLE\ FOR\ ANY\ CLAIM,\ DAMAGES\ OR\ OTHER\ LIABILITY,\ WHETHER}}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ IN\ AN\ ACTION\ OF\ CONTRACT,\ TORT\ OR\ OTHERWISE,\ ARISING\ FROM,\ OUT\ OF\ OR\ IN}}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ CONNECTION\ WITH\ THE\ SOFTWARE\ OR\ THE\ USE\ OR\ OTHER\ DEALINGS\ IN\ THE\ SOFTWARE.}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ *\ http://www.FreeRTOS.org}}
\DoxyCodeLine{00023\ \textcolor{comment}{\ *\ http://aws.amazon.com/freertos}}
\DoxyCodeLine{00024\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00025\ \textcolor{comment}{\ *\ 1\ tab\ ==\ 4\ spaces!}}
\DoxyCodeLine{00026\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00027\ }
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00029\ \textcolor{comment}{/*}}
\DoxyCodeLine{00030\ \textcolor{comment}{\ *\ Message\ buffers\ build\ functionality\ on\ top\ of\ FreeRTOS\ stream\ buffers.}}
\DoxyCodeLine{00031\ \textcolor{comment}{\ *\ Whereas\ stream\ buffers\ are\ used\ to\ send\ a\ continuous\ stream\ of\ data\ from\ one}}
\DoxyCodeLine{00032\ \textcolor{comment}{\ *\ task\ or\ interrupt\ to\ another,\ message\ buffers\ are\ used\ to\ send\ variable}}
\DoxyCodeLine{00033\ \textcolor{comment}{\ *\ length\ discrete\ messages\ from\ one\ task\ or\ interrupt\ to\ another.\ \ Their}}
\DoxyCodeLine{00034\ \textcolor{comment}{\ *\ implementation\ is\ light\ weight,\ making\ them\ particularly\ suited\ for\ interrupt}}
\DoxyCodeLine{00035\ \textcolor{comment}{\ *\ to\ task\ and\ core\ to\ core\ communication\ scenarios.}}
\DoxyCodeLine{00036\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00037\ \textcolor{comment}{\ *\ ***NOTE***:\ \ Uniquely\ among\ FreeRTOS\ objects,\ the\ stream\ buffer}}
\DoxyCodeLine{00038\ \textcolor{comment}{\ *\ implementation\ (so\ also\ the\ message\ buffer\ implementation,\ as\ message\ buffers}}
\DoxyCodeLine{00039\ \textcolor{comment}{\ *\ are\ built\ on\ top\ of\ stream\ buffers)\ assumes\ there\ is\ only\ one\ task\ or}}
\DoxyCodeLine{00040\ \textcolor{comment}{\ *\ interrupt\ that\ will\ write\ to\ the\ buffer\ (the\ writer),\ and\ only\ one\ task\ or}}
\DoxyCodeLine{00041\ \textcolor{comment}{\ *\ interrupt\ that\ will\ read\ from\ the\ buffer\ (the\ reader).\ \ It\ is\ safe\ for\ the}}
\DoxyCodeLine{00042\ \textcolor{comment}{\ *\ writer\ and\ reader\ to\ be\ different\ tasks\ or\ interrupts,\ but,\ unlike\ other}}
\DoxyCodeLine{00043\ \textcolor{comment}{\ *\ FreeRTOS\ objects,\ it\ is\ not\ safe\ to\ have\ multiple\ different\ writers\ or}}
\DoxyCodeLine{00044\ \textcolor{comment}{\ *\ multiple\ different\ readers.\ \ If\ there\ are\ to\ be\ multiple\ different\ writers}}
\DoxyCodeLine{00045\ \textcolor{comment}{\ *\ then\ the\ application\ writer\ must\ place\ each\ call\ to\ a\ writing\ API\ function}}
\DoxyCodeLine{00046\ \textcolor{comment}{\ *\ (such\ as\ xMessageBufferSend())\ inside\ a\ critical\ section\ and\ set\ the\ send}}
\DoxyCodeLine{00047\ \textcolor{comment}{\ *\ block\ time\ to\ 0.\ \ Likewise,\ if\ there\ are\ to\ be\ multiple\ different\ readers}}
\DoxyCodeLine{00048\ \textcolor{comment}{\ *\ then\ the\ application\ writer\ must\ place\ each\ call\ to\ a\ reading\ API\ function}}
\DoxyCodeLine{00049\ \textcolor{comment}{\ *\ (such\ as\ xMessageBufferRead())\ inside\ a\ critical\ section\ and\ set\ the\ receive}}
\DoxyCodeLine{00050\ \textcolor{comment}{\ *\ timeout\ to\ 0.}}
\DoxyCodeLine{00051\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00052\ \textcolor{comment}{\ *\ Message\ buffers\ hold\ variable\ length\ messages.\ \ To\ enable\ that,\ when\ a}}
\DoxyCodeLine{00053\ \textcolor{comment}{\ *\ message\ is\ written\ to\ the\ message\ buffer\ an\ additional\ sizeof(\ size\_t\ )\ bytes}}
\DoxyCodeLine{00054\ \textcolor{comment}{\ *\ are\ also\ written\ to\ store\ the\ message's\ length\ (that\ happens\ internally,\ with}}
\DoxyCodeLine{00055\ \textcolor{comment}{\ *\ the\ API\ function).\ \ sizeof(\ size\_t\ )\ is\ typically\ 4\ bytes\ on\ a\ 32-\/bit}}
\DoxyCodeLine{00056\ \textcolor{comment}{\ *\ architecture,\ so\ writing\ a\ 10\ byte\ message\ to\ a\ message\ buffer\ on\ a\ 32-\/bit}}
\DoxyCodeLine{00057\ \textcolor{comment}{\ *\ architecture\ will\ actually\ reduce\ the\ available\ space\ in\ the\ message\ buffer}}
\DoxyCodeLine{00058\ \textcolor{comment}{\ *\ by\ 14\ bytes\ (10\ byte\ are\ used\ by\ the\ message,\ and\ 4\ bytes\ to\ hold\ the\ length}}
\DoxyCodeLine{00059\ \textcolor{comment}{\ *\ of\ the\ message).}}
\DoxyCodeLine{00060\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00062\ \textcolor{preprocessor}{\#ifndef\ FREERTOS\_MESSAGE\_BUFFER\_H}}
\DoxyCodeLine{00063\ \textcolor{preprocessor}{\#define\ FREERTOS\_MESSAGE\_BUFFER\_H}}
\DoxyCodeLine{00064\ }
\DoxyCodeLine{00065\ \textcolor{preprocessor}{\#ifndef\ INC\_FREERTOS\_H}}
\DoxyCodeLine{00066\ \textcolor{preprocessor}{\ \ \ \ \#error\ "{}include\ FreeRTOS.h\ must\ appear\ in\ source\ files\ before\ include\ message\_buffer.h"{}}}
\DoxyCodeLine{00067\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ \textcolor{comment}{/*\ Message\ buffers\ are\ built\ onto\ of\ stream\ buffers.\ */}}
\DoxyCodeLine{00070\ \textcolor{preprocessor}{\#include\ "{}stream\_buffer.h"{}}}
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00072\ \textcolor{preprocessor}{\#if\ defined(\ \_\_cplusplus\ )}}
\DoxyCodeLine{00073\ \textcolor{keyword}{extern}\ \textcolor{stringliteral}{"{}C"{}}\ \{}
\DoxyCodeLine{00074\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00082\ \textcolor{keyword}{typedef}\ \textcolor{keywordtype}{void}\ *\ MessageBufferHandle\_t;}
\DoxyCodeLine{00083\ }
\DoxyCodeLine{00084\ \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00142\ \textcolor{preprocessor}{\#define\ xMessageBufferCreate(\ xBufferSizeBytes\ )\ (\ MessageBufferHandle\_t\ )\ xStreamBufferGenericCreate(\ xBufferSizeBytes,\ (\ size\_t\ )\ 0,\ pdTRUE\ )}}
\DoxyCodeLine{00143\ }
\DoxyCodeLine{00208\ \textcolor{preprocessor}{\#define\ xMessageBufferCreateStatic(\ xBufferSizeBytes,\ pucMessageBufferStorageArea,\ pxStaticMessageBuffer\ )\ (\ MessageBufferHandle\_t\ )\ xStreamBufferGenericCreateStatic(\ xBufferSizeBytes,\ 0,\ pdTRUE,\ pucMessageBufferStorageArea,\ pxStaticMessageBuffer\ )}}
\DoxyCodeLine{00209\ }
\DoxyCodeLine{00307\ \textcolor{preprocessor}{\#define\ xMessageBufferSend(\ xMessageBuffer,\ pvTxData,\ xDataLengthBytes,\ xTicksToWait\ )\ xStreamBufferSend(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer,\ pvTxData,\ xDataLengthBytes,\ xTicksToWait\ )}}
\DoxyCodeLine{00308\ }
\DoxyCodeLine{00411\ \textcolor{preprocessor}{\#define\ xMessageBufferSendFromISR(\ xMessageBuffer,\ pvTxData,\ xDataLengthBytes,\ pxHigherPriorityTaskWoken\ )\ xStreamBufferSendFromISR(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer,\ pvTxData,\ xDataLengthBytes,\ pxHigherPriorityTaskWoken\ )}}
\DoxyCodeLine{00412\ }
\DoxyCodeLine{00499\ \textcolor{preprocessor}{\#define\ xMessageBufferReceive(\ xMessageBuffer,\ pvRxData,\ xBufferLengthBytes,\ xTicksToWait\ )\ xStreamBufferReceive(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer,\ pvRxData,\ xBufferLengthBytes,\ xTicksToWait\ )}}
\DoxyCodeLine{00500\ }
\DoxyCodeLine{00501\ }
\DoxyCodeLine{00600\ \textcolor{preprocessor}{\#define\ xMessageBufferReceiveFromISR(\ xMessageBuffer,\ pvRxData,\ xBufferLengthBytes,\ pxHigherPriorityTaskWoken\ )\ xStreamBufferReceiveFromISR(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer,\ pvRxData,\ xBufferLengthBytes,\ pxHigherPriorityTaskWoken\ )}}
\DoxyCodeLine{00601\ }
\DoxyCodeLine{00620\ \textcolor{preprocessor}{\#define\ vMessageBufferDelete(\ xMessageBuffer\ )\ vStreamBufferDelete(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer\ )}}
\DoxyCodeLine{00621\ }
\DoxyCodeLine{00637\ \textcolor{preprocessor}{\#define\ xMessageBufferIsFull(\ xMessageBuffer\ )\ xStreamBufferIsFull(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer\ )}}
\DoxyCodeLine{00638\ }
\DoxyCodeLine{00653\ \textcolor{preprocessor}{\#define\ xMessageBufferIsEmpty(\ xMessageBuffer\ )\ xStreamBufferIsEmpty(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer\ )}}
\DoxyCodeLine{00654\ }
\DoxyCodeLine{00676\ \textcolor{preprocessor}{\#define\ xMessageBufferReset(\ xMessageBuffer\ )\ xStreamBufferReset(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer\ )}}
\DoxyCodeLine{00677\ }
\DoxyCodeLine{00678\ }
\DoxyCodeLine{00698\ \textcolor{preprocessor}{\#define\ xMessageBufferSpaceAvailable(\ xMessageBuffer\ )\ xStreamBufferSpacesAvailable(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer\ )}}
\DoxyCodeLine{00699\ \textcolor{preprocessor}{\#define\ xMessageBufferSpacesAvailable(\ xMessageBuffer\ )\ xStreamBufferSpacesAvailable(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer\ )\ }\textcolor{comment}{/*\ Corrects\ typo\ in\ original\ macro\ name.\ */}\textcolor{preprocessor}{}}
\DoxyCodeLine{00700\ }
\DoxyCodeLine{00718\ \textcolor{preprocessor}{\#define\ xMessageBufferNextLengthBytes(\ xMessageBuffer\ )\ xStreamBufferNextMessageLengthBytes(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer\ )\ PRIVILEGED\_FUNCTION;}}
\DoxyCodeLine{00719\ }
\DoxyCodeLine{00757\ \textcolor{preprocessor}{\#define\ xMessageBufferSendCompletedFromISR(\ xMessageBuffer,\ pxHigherPriorityTaskWoken\ )\ xStreamBufferSendCompletedFromISR(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer,\ pxHigherPriorityTaskWoken\ )}}
\DoxyCodeLine{00758\ }
\DoxyCodeLine{00797\ \textcolor{preprocessor}{\#define\ xMessageBufferReceiveCompletedFromISR(\ xMessageBuffer,\ pxHigherPriorityTaskWoken\ )\ xStreamBufferReceiveCompletedFromISR(\ (\ StreamBufferHandle\_t\ )\ xMessageBuffer,\ pxHigherPriorityTaskWoken\ )}}
\DoxyCodeLine{00798\ }
\DoxyCodeLine{00799\ \textcolor{preprocessor}{\#if\ defined(\ \_\_cplusplus\ )}}
\DoxyCodeLine{00800\ \}\ \textcolor{comment}{/*\ extern\ "{}C"{}\ */}}
\DoxyCodeLine{00801\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00802\ }
\DoxyCodeLine{00803\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{/*\ !defined(\ FREERTOS\_MESSAGE\_BUFFER\_H\ )\ */}\textcolor{preprocessor}{}}

\end{DoxyCode}
